# Contributor: Alex Yam <alex@alexyam.com>
# Maintainer: mio <miyopan@e.email>
pkgname=fig2dev
pkgver=3.2.9
pkgrel=0
pkgdesc="translates Fig code to other graphic description languages"
url="https://sourceforge.net/projects/mcj/"
arch="all"
license="Xfig"
makedepends="
	diffutils
	ghostscript
	gzip
	imagemagick
	libpng-dev
	netpbm
	zlib-dev
	"
subpackages="$pkgname-doc"
source="https://downloads.sourceforge.net/mcj/fig2dev-$pkgver.tar.xz
	COPYING
	"

# secfixes:
#   3.2.8b-r0:
#     - CVE-2021-37529
#     - CVE-2021-37530

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--enable-transfig
	make
}

check() {
	# Temporarily skip failed tests (104 tests run, 4 failed, 4 skipped)
	# testsuite: 17 90 106 108 failed
	# https://sourceforge.net/p/mcj/tickets/171/
	# Find and decompress embedded image files. / 17: read compressed image files
	# Create and embed bitmaps in fig-file. / 90: gif
	# Embed postscript variants. / 106: postscript, created by latex / 108: pdf
	make check TESTSUITEFLAGS="1-16 18-89 91-105 107"
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 ../COPYING -t "$pkgdir"/usr/share/licenses/$pkgname/
}

sha512sums="
4a92539d79027c73cd9fa53d7e960db40ae5616d3197023a98346de4727cd70b28cd7d64ba33063dbe3dcacada7e97bb0e0c595547781a4244aea8c75d43f406  fig2dev-3.2.9.tar.xz
0289c266555028702e15749e557c7f17eaecc908f61458dbcfc118f547dbfb831351ec7cfce290368d343a7d7e9fa6914e81103312d94939938571f2acdc9424  COPYING
"
